const validatePhone = (rule, value, callback) => {
  if (!/^1[3456789]\d{9}$/.test(value) && value) {
    callback(new Error("请输入正确的手机号"));
  } else {
    callback();
  }
};

var checkEmail = (rule, value, callback) => {
  const mailReg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/
  setTimeout(() => {
    if (mailReg.test(value) || !value) {
      callback()
    } else {
      callback(new Error('请输入正确的邮箱格式'))
    }
  }, 100)
}

export const listOption = {
  border: true,
  stripe: true,
  menuAlign: "center",
  searchLabelWidth: 100,
  viewBtn: true,
  dialogFullscreen: true,
  labelWidth: "200",
  delBtn: false,
  searchMenuSpan: 6,
  searchSpan: 7,
  align: "center",
  addBtn: false,
  editBtn: false,
  column: [{
      label: "真实姓名",
      prop: "name",
      span: 24
    }, 
    {
      label: "身份",
      prop: "identity",
      span: 24,
    },

    {
      label: "公司",
      prop: "company_name",
      span: 24,
    },
    {
      label: "职级",
      prop: "position",
      hide: true,
      span: 24,
    },
    {
      label: "职位",
      prop: "position_name",
      span: 24,
    },
    {
      label: "手机号",
      prop: "auth_phone",
      span: 24
    },
    {
      label: "工作邮箱",
      prop: "auth_mail",
      span: 24,
    },
    {
      label: '微信号',
      prop: 'auth_wechat',
      span: 24,
    },
    {
      label: '名片',
      prop: "apply_img",
      span: 24,
      type: 'upload',
      listType: 'picture-img',
      span: 24
    },
    {
      label: '认领人物',
      prop: 'figure_id',
      span: 24,
      slot: true,
    },
    {
      label: '认证状态',
      prop: "status",
      type: 'radio',
      width: 160,
      dicData: [{
          label: "未提交",
          value: 0
        },{
          label: "提交中",
          value: 1
        },
        {
          label: "已提交，未处理",
          value: 2
        },{
          label: "普通认证",
          value: 3
        },{
          label: "高级认证",
          value: 4
        }
      ],
      span: 24,
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
    },
    {
      label: 'VIP',
      prop: "pay_status",
      type: 'radio',
      width: 160,
      dicData: [{
          label: "未支付",
          value: 0
        },{
          label: "已支付（VIP）",
          value: 1
        },{
          label: "已支付（SVIP）",
          value: 2
        },{
          label: "后台操作（VIP）",
          value: 3
        },{
          label: "后台操作（SVIP）",
          value: 4
        }
      ],
      span: 24,
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
    },
    {
      label: '头像',
      prop: 'avatar',
      span: 24,
      type: 'upload',
      listType: 'picture-img',
      hide: true
    },
    {
      label: '常驻城市',
      prop: 'city_name',
      span: 24,
      hide: true
    },
    {
      label: '个人简介',
      prop: 'info',
      type: 'textarea',
      span: 24,
      hide: true
    },
    {
      label: '合作需求',
      prop: 'message',
      type: 'textarea',
      span: 24,
      hide: true
    },
    {
      label: '行业',
      prop: 'industry',
      span: 24,
      hide: true
    },
    {
      label: '轮次',
      prop: 'round',
      span: 24,
      hide: true
    },
    {
      label: '公司简介',
      prop: 'company_info',
      type: 'textarea',
      span: 24,
      hide: true
    }
  ]
};

export const detailOption = {
  detail:true,
  column: [{
    label: "人物ID",
    prop: "id",
    detail: true,
    span: 24
  }, {
    label: "姓名",
    prop: "name",
    span: 24,
    detail: true,
  },
  {
    label: "身份",
    prop: "identity",
    span: 24,
    detail: true,
  },

  {
    label: "公司",
    prop: "company_name",
    span: 24,
    detail: true,
  },{
    label: "职级",
    prop: "position",
    span: 24,
    detail: true,
  },
  {
    label: "职位",
    prop: "position_name",
    span: 24,
    detail: true,
  },
  {
    label: "所在地",
    prop: "city_name",
    span: 24,
    detail: true,
  },
  {
    label: "有无联系方式",
    prop: "has_contact",
    type: "radio",
    detail: true,
    dicData: [{
        label: "无",
        value: 0
      },
      {
        label: "有",
        value: 1
      }
    ],
    span: 24
  },
  {
    label: "身份标签",
    prop: "identityTag",
    width: 100,
    span: 24,
    detail: true,
    type: "select",
    dicFlag: true,
    dicUrl: process.env.VUE_APP_BASE_API + "/admin/identity/all",
    dicFormatter: res => {
      return (res.data || []).map(o => ({
        label: o.name,
        value: o.name
      }));
    },
    props: {
      label: "label",
      value: "value"
    },
  },
  {
    label: "个人简介",
    prop: "info",
    detail: true,
    type: 'textarea',
    span: 24,
  },{
    label: "合作需求",
    prop: "message",
    detail: true,
    type: 'textarea',
    span: 24,
  },{
    label: '手机',
    prop: 'phone',
    span: 12,
    detail: true,
  },{
    label: '邮箱',
    prop: 'mail',
    span: 12,
    detail: true,
  },
  {
    label: '微信',
    prop: 'wechat',
    span: 12,
    detail: true,
  },
  {
    label: '行业',
    prop: 'industry',
    span: 12,
    detail: true,
  },
  {
    label: '轮次',
    prop: 'round',
    detail: true,
  },
  {
    label: "公司简介",
    prop: "company_info",
    type: 'textarea',
    span: 24,
    detail: true,
  },]
}

